﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/TemplateUser.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@import Namespace="ManageBanking.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	
	
	
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">


   <%Username us = (Username)Session["Login"]; %>
   
    <div class="center_block_top"><span>&nbsp;</span><h3>Registry</h3></div>
<div class="center_block_mau"><!--section-->
	<div id="intro">
<blockquote>
  <% if (ViewData["Result"] == "true")
      {
                  %>
         <div class="succes">
					<div class="succes_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Success!</span>
						<p>Your Action Is Success</p>
					</div>
				</div>
				<div class="clear"><!-- --></div>   
				<%} %>
				<%else if (ViewData["Result"] != null)
    { %>
				<div class="err">
					<div class="err_icon"><!-- --></div>
					<a href="#" class="close" title="Close this notification">x</a>
					<div class="desc">
						<span>Error!</span>
						<p><%=ViewData["Result"]%></p>
					</div>
				</div>
				<%} %>
  <div class="redistry">
  		<%using (Html.BeginForm("ResolveAddAcc", "Cashier", FormMethod.Post, new { @id = "f1" }))
      { %>
      <input id="Hidden2" type="hidden" name="idadmin" value="<%=us.IdUsername %>" />
  		<ul>
        	<li>
            	<span>User Name:</span>
            	<div class="input_text"></div>
            	<div><input name="username" id="username" type="text" size="20" /> 
                    <input id="type" type="hidden" value="<%=us.IdTypeUser %>" />
            	</div>
            	
            	<div></div>
            	
            	 <div id="divcheck" class="error" visible="true"></div>
            	
            	
            	</li>
            <li>
            	<span>Password:</span>
            	<div class="input_text"></div>
            	<div><input name="password" type="password" id="password" size="20" /></div>
                <input id="a" type="hidden" />
            	<input id="b" type="hidden" />
            	<input id="c" type="hidden" />
            	</li>
            
            <li>
            	<span>Confirm Password:</span>
            	<div class="input_text"></div>
            	<div><input name="con_password" type="password" id="con_password" size="20" /></div>
            	
            	</li>
            	
            <li>
            
            	<span>Secondary Password:</span>
            	<div class="input_text"></div>
            	<div><input name="phase" type="password" id="phase" size="20" /></div></li>
            <li>
            	<span>Name:</span>
            	<div class="input_text"></div>
            	<div><input name="name" type="text" size="20" id="name" /></div></li>
            <li>
            	<span>Identity Card:</span>
            	<div class="input_text"></div>
            	<div><input name="identificard" type="text" size="20" id="identificard" /></div>
            	
            	<div id="divcheckIden" class="error" visible="true"></div>
            	</li>
            	
            <li>
            	<span>Sex:</span>
            	<input type="radio" checked="checked" name="sex" value="Male" />Male &nbsp;&nbsp;
                <input type="radio"  name="sex" value="Female" />Female</li>
            <li>
            	<span>BirthDay:</span>
            	<div class="input_text"></div>
            	<div><input name="birth" id="birth" type="text" id="birth" size="20" /></div>
            	<div class="check1">
            	<a id="CheckBirth" href="#"> Check</a>
            	
            	</div>
            	<div id="divcheckbirth" class="error" visible="true"></div>
            	
                <input id="d" type="hidden" value="0" />
            	</li>
            <li>
            	<span>Address:</span>
            	<div class="input_text"></div>
            	<div><input name="address" id="address" type="text" size="20" /></div></li>
            <li>
            	<span>Email:</span>
            	<div class="input_text"></div>
            	<div><input name="Email" id="Email" type="text" size="20" /></div>
      
            	<div id="divcheckEm" class="error" visible="true"></div>
            	</li>
            <li>
            	<span>PlaceBirth:</span>
            	<div class="input_text"></div>
            	<div><input name="PlaceBirth" id="PlaceBirth" type="text" size="20" /></div></li>
            <li>
            	<span>Job:</span>
            	<div class="input_text"></div>
            	<div><input name="job" id="job" type="text" size="20" /></div></li>
        <li>
            	<span>TypeAccount</span>
            	<div class="input_text">
            	    <select class="combobox-addacc" name="IdType">
            	        <% foreach (TypeAccount tac in (List<TypeAccount>)ViewData["listtypeacc"])
                        {%>
            	        <option class="option-addacc" value='<%= tac.IdType %>' ><%= tac.TypeName%></option>
            	        <% } %>
            	    </select>
            	</div></li>
               <li>
            	<span>Money Deposit:</span>
            	<div class="input_text"></div>
            	<div><input name="money" id="money" type="text" size="20" /></div>
                   <input id="e" type="hidden" value="0" />
    <div id="divcheckmoney" class="error" visible="true"></div>
    </li>  
    
              <input id="Hidden3" name="TypeUser" value="2" type="hidden" />
            
                
              <input id="Hidden1" name="TypeUser" value="2" type="hidden" />
            
                <li>
            	<span>&nbsp;</span>
                <ul>
                	<li ><input type="submit" name="button" value="OK" class="ok"/></li>
                    <li id="cancel" ><input type="reset" name="button" value="Reset" class="ok" />
                    
                    
                    </li>
                </ul>
            </li>
        </ul>
        <%} %>
  </div>
 
</blockquote>
<div class="clearBoth"></div>
<blockquote>
 
</blockquote>
</div>
<!--//intro-->
</div>
<div class="center_block_bottom_mau"></div>
<%DateTime past = DateTime.Now.AddYears(-18);
  DateTime now = DateTime.Now;
  string now1 = now.ToString("yyyy");
  string past1 = past.ToString("yyyy"); %>
    <input id="now" value="<%=now1%>" type="hidden" />
    <input id="past" value="<%=past1%>" type="hidden" />
    
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderScript" runat="server">
<script src="../../../../Scripts/jquery.validate.js" type="text/javascript">
</script>

    <link href="../../Content/css/jquery-ui-1.8.2.custom.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/css/SucErr1.css" rel="stylesheet" type="text/css" />

    <script src="../../Scripts/wysiwyg.js" type="text/javascript"></script>

    <script src="../../Scripts/functions.js" type="text/javascript"></script>
	<style type="text/css">
       .ui-autocomplete
       {
       
       	margin-left:760px;
       	margin-top:208px
              
       }
        .green

        {
            float:left;
            color: Green;
            margin-left:218px;
            margin-top:-9px;
        }

        .red

        {   float:left;
            margin-left:218px;
            color: Red;
            margin-top:-9px;
        }
        #divcheck
        {
        float:left;
        margin-left:14px;
        margin-top:-9px;	
        }
        .btnCheck
        {
        margin-left:11px;	
        	
        }
    </style>
	 <script type="text/javascript">
	    var a = 0;
        var b = 0;
        var c = 0;
        var d = 0;
        var e = 0;
        $(document).ready(function() {
        


            $("#username").keyup(function() {
                var status = $("#divcheck");
                status.html("");
                a == 0;
                $('#a').attr("value", 0);

            });
            $("#username").blur(function() {

                var name = $("#username").val();

                var status = $("#divcheck");

                status.html("Checking....").removeClass(); ;

                $.post("/ManageUserAdmin/CheckName", { username: name },

                    function(data) {

                        if (data == true) {

                            status.html("Username is Valid!").addClass("green");
                            a == 1;
                            $('#a').attr("value", 1);

                        } else {

                        status.html("Username is Not Valid!").addClass("red");
                            a == 0;
                            $('#a').attr("value", 0);
                        }

                    });

            });

        });
    </script>
   <script type="text/javascript">
       $(document).ready(function() {
       $("#money").keyup(function() {
       var status = $("#divcheckmoney");
           status.html("");
           a == 0;
           $('#e').attr("value", 0);

       });
       $("#money").blur(function() {

           var name = $("#money").val();
           var name1 = $("#ttmoney").val();

           var status = $("#divcheckmoney");

           status.html("Checking....").removeClass(); ;

           $.post("/T_Account/CheckMoney1", { money: name},

                    function(data) {

                        if (data == true) {

                            status.html("Money is Valid!!!!!!").addClass("green");
                            a == 1;
                            $('#e').attr("value", 1);

                        } else {

                            status.html("Money Is Invalid!!!!!!").addClass("red");
                            a == 0;
                            $('#e').attr("value", 0);
                        }

                    });

       });

       });
   
   
   </script>  
  <script type="text/javascript">

      $(document).ready(function() {
          


          $("#Email").keyup(function() {
              var status = $("#divcheckEm");
              status.html("");
              $('#b').attr("value", 0);
          });
          $("#Email").blur(function() {

              var name = $("#Email").val();

              var status = $("#divcheckEm");

              status.html("Checking....").removeClass(); ;

              $.post("/ManageUserAdmin/CheckEmail", { Email: name },

                    function(data) {

                        if (data == true) {

                            status.html("Email is Valid!!!!!!!").addClass("green");
                            $('#b').attr("value", 1);

                        } else {

                            status.html("Email is Not Valid!!!!!").addClass("red");
                            $('#b').attr("value", 0);

                        }

                    });

          });

      });
    </script>
  <script type="text/javascript">

      $(document).ready(function() {



          $("#birth").click(function() {
              var status = $("#divcheckbirth");
              status.html("");
              $('#d').attr("value", 0);
          });
          $("#CheckBirth").click(function() {

              var name = $("#birth").val();

              var status = $("#divcheckbirth");

              status.html("Checking....").removeClass(); ;

              $.post("/ManageUserAdmin/CheckBirthday", { birth: name },

                    function(data) {

                        if (data == true) {

                            status.html("Birthday is Valid!!!!!!!").addClass("green");
                            $('#d').attr("value", 1);

                        } else {

                            status.html("You Must Be Above 18 Year Old").addClass("red");
                            $('#d').attr("value", 0);

                        }

                    });

          });

      });
    </script>
  
    
    
    
    
    
    
    <script type="text/javascript">

        $(document).ready(function() {

            $("#identificard").keyup(function() {
                var status = $("#divcheckIden");
                status.html("");
                $('#c').attr("value", 0);
            });
            $("#identificard").blur(function() {

                var name = $("#identificard").val();

                var status = $("#divcheckIden");

                status.html("Checking....").removeClass(); ;

                $.post("/ManageUserAdmin/CheckIdentify", { identificard: name },

                    function(data) {

                        if (data == true) {

                            status.html("Identify Card is Valid!").addClass("green");

                            $('#c').attr("value", 1);

                        } else {

                            status.html("Identify Card is Not Valid").addClass("red");
                            $('#c').attr("value", 0);

                        }

                    });


            });

            $('#f1').submit(function() {
                a = $('#a').attr("value");
                b = $('#b').attr("value");
                c = $('#c').attr("value");
                d = $('#d').attr("value");
                e = $('#e').attr("value");
                if (a == 0) {
                    alert("Please Check Username,Or Username Not Valid");
                    return false;
                }
                else if (c == 0) {
                    alert("Please Check IdentifyCard,Or Identify Card Not Valid"); return false;
                }
                else if (b == 0) {
                    alert("Please Check Email,Or Email Not Valid");
                    return false;
                }
                else if (d == 0) {
                alert("Please Check Birthday,Or Birthday Not Valid");
                return false;
                }
                else if (e == 0) {
                    alert("Please Check Money,Or Money Not Valid");
                    return false;
                }

                else if (a == 1 && b == 1 && c == 1 && d==1 && e==1)
                    return true;
                return false;
            });



        });
    </script>
	
	
	<script language="javascript" type="text/javascript">
	    $(document).ready(function() {
          
            
            
	        $('#f1').validate({
	            rules: {
	                username: {
	                    required: true
	                },
	                password: {
	                    required: true,
	                    minlength: 6,
	                    maxlength: 15
	                },
	                con_password: {
	                    required: true,
	                    minlength: 6,
	                    maxlength: 15,
	                    equalTo: "#password"
	                },
	                phase: {
	                    required: true,
	                    minlength: 6,
	                    maxlength: 15
	                },
	                name: {
	                    required: true
	                },
	                identificard: {
	                    required: true,
	                    number: true,
	                    maxlength: 20,
	                    minlength: 9

	                },
	                birth: {
	                    required: true
	                },
	                address: {
	                    required: true

	                },
	                Email: {
	                    required: true,
	                    email: true

	                },
	                PlaceBirth: {
	                    required: true
	                },
	                job: {
	                    required: true
	                }
	                



	            }, //ket thuc rules
	            messages: {
	                username: {
	                    required: "Username not null!!!"
	                },
	                password: {
	                    required: "Password can not be null!!!",
	                    minlength: "Not Less than 6 digit!!!!",
	                    maxlength: "Not more than 15 digit!!!!"
	                },
	                con_password: {
	                    required: "Confirm pass not be null!!!!",
	                    minlength: "Not Less than 6 digit!!!!",
	                    maxlength: "Not more than 15 digit!!!!",
	                    equalTo: "Password and Confirm Password must be same"
	                },
	                phase: {
	                    required: "Secondary pass not null!!!!",
	                    minlength: "Not Less than 6 digit",
	                    maxlength: "Not more than 15 digit"
	                },
	                name: {
	                    required: "Name can not be null!!!!!!"
	                },
	                identificard: {
	                    required: "Identificard can not be null!!!!",
	                    number: "Identificard Must be number",
                        maxlength: "Not more than 20 digit!!!!",
                        minlength: "Not less than 9 digit"
	                },
	                birth: {
	                    required: "Birth can not be null!!!!"
	                },
	                address: {
	                    required: "Address not null!!!!!"

	                },
	                Email: {
	                    required: "Email can not be null !!!!!",
	                    email: "Email Must be under email form xxx@xxx.xxx"

	                },
	                PlaceBirth: {
	                    required: "Place Birth can not be null"
	                },
	                job: {
	                    required: "Job can not be null !!!!!"
	                }
	               



	            }
	        });  // ket thuc validate

	        // $('#oldpassword').keyup(function() {
	        //         $('#messge_error').html("");
	        //    });
	        
            
	        });
	        $(document).ready(function() {
	        var now = $("#now").attr("value");
            var past = $("#past").attr("value");
             
	            $('#birth').datepicker({
	               
	                changeMonth: true,
	                changeYear: true,
	                dateFormat: 'yy-mm-dd',
	                yearRange: 1950+':'+now,
	                onSelect: function(dateText, inst) {
	                
	                 }

	            });
	        });             // ket thuc ready
    </script>
</asp:Content>
